<template>
	<view class="list">
		<view class="list_title">
			资讯列表
		</view>
		<view class="list_box" v-for="(item, key) in Newslist" :key="key">
			<view class="box" @click="getlist(item.id)">
				<image :src="item.thumbnail_pic"></image>
				<view class="box_right">
					<p class="P_title">{{item.title}}</p>
					<p class="p_link">{{item.summary}}</p>
					<p class="p_time">2020-07-17 15:43</p>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: '资讯',
				Newslist: []
			}
		},
		onLoad() {
			this.getNews()
		},
		methods: {
			getNews() {
				let data = {
					page: "1",
					limit: "5"
				}
				this.$api.Newsindex(data).then(res => {
					if (res.data.msg === "操作成功") {
						this.Newslist = res.data.data.list
					}
				}, err => {})
			},
			getlist(id){
				uni.navigateTo({
					url:"./infolist?id="+id
				})
			}
		}
	}
</script>

<style lang="less">
	.list {
		width: 100%;
		// height: 1334rpx;
		margin-top: 40rpx;
	
		.list_title {
			width: 100%;
			height: 32rpx;
			border-left: 2px solid #4104B7;
			font-size: 40rpx;
			color: #333333;
			line-height: 32rpx;
			margin-left: 36rpx;
			padding-left: 20rpx;
		}
	
		.list_box {
			padding: 0 20rpx;
			margin-top: 36rpx;
	
			.box {
				display: flex;
				height: 288rpx;
				background: #FFFFFF;
				border-radius: 9px;
				padding: 34rpx 32rpx;
				justify-content: center;
	
				image {
					width: 106px;
					height: 110px;
					background: rgba(0, 0, 0, 0);
					opacity: 1;
					border-radius: 8px;
				}
	
				.box_right {
					background: #FFFFFF;
					width: 62%;
					margin-left: 26rpx;
	
					.P_title {
						background: #FFFFFF;
						color: #000000;
						font-size: 38rpx;
						white-space: nowrap;
						text-overflow: ellipsis;
						overflow: hidden;
					}
	
					.p_link {
						background: #FFFFFF;
						color: #333333;
						font-size: 26rpx;
						margin-top: 30rpx;
						word-break: break-all;
						text-overflow: ellipsis;
						display: -webkit-box;
						-webkit-box-orient: vertical;
						-webkit-line-clamp: 2;
						overflow: hidden;
					}
	
					.p_time {
						background: #FFFFFF;
						color: #999999;
						font-size: 26rpx;
						margin-top: 30rpx;
					}
				}
			}
		}
	}
</style>
